package a.f.l.a;

import a.c.d;
import a.c.y;
import a.c.z;

import java.util.HashSet;
import java.util.Iterator;

class ec
  extends sb
  implements sc
{
  private int f;
  
  protected void b(rb paramrb)
  {
    super.b(paramrb);
    this.f = paramrb.e().f().b();
    if ((sb.e) || (d())) {
      paramrb.a().a(this);
    }
  }
  
  protected void c(rb paramrb)
  {
    super.c(paramrb);
    if ((sb.e) || (d())) {
      b().a().c(this);
    }
  }
  
  protected void d(rb paramrb)
  {
    super.d(paramrb);
    if ((sb.e) || (d())) {
      b().a().c(this);
    }
  }
  
  private boolean d()
  {
    if (!sb.e) {}
    return this.f > 0;
  }
  
  double[] a(h paramh, mb parammb, jb[] paramArrayOfjb, m[] paramArrayOfm, double[] paramArrayOfDouble)
  {
    if (!sb.e) {
      if (!d())
      {
        b("crossing cost", 0.0D, false);
        return new double[paramArrayOfjb.length];
      }
    }
    return super.a(paramh, parammb, paramArrayOfjb, paramArrayOfm, paramArrayOfDouble);
  }
  
  protected double a(h paramh, mb parammb, jb paramjb, m paramm, double paramDouble)
  {
    boolean bool = sb.e;
    int k = sb.d;
    int i = 0;
    if ((bool) || (paramm != null))
    {
      if (bool) {
        break label551;
      }
      if (paramm.e() == 0)
      {
        if (bool) {
          break label551;
        }
        if (!paramm.m().g(paramm.n()))
        {
          jb localjb1 = paramm.m();
          eb localeb1 = localjb1.e();
          eb localeb2 = paramjb.e();
          jb localjb2 = new jb(localeb2, localjb1.f(), localjb1.a());
          m localm1 = null;
          m localm2 = new m(paramm.k(), paramm.l(), localjb2, paramm.n(), paramm.o(), paramm.p(), paramm.f());
          z localz = new z();
          localz.add(new b_(paramh, localm1, localm2, null));
          localm1 = paramh.j();
          Object localObject1 = paramh.b();
          Object localObject2;
          label424:
          do
          {
            if ((localObject1 == null) || (localm1 == null)) {
              break;
            }
            localObject2 = localjb1;
            jb localjb3 = localjb2;
            if ((bool) || (localm1.e() == 0)) {
              if (bool) {}
            }
            int j = !localm1.m().g(localjb3) ? 1 : 0;
            if (!bool)
            {
              if (j != 0)
              {
                localjb1 = new jb(localeb1, localm1.m().f(), localm1.m().a());
                localjb2 = new jb(localeb2, localm1.m().f(), localm1.m().a());
                if (bool) {
                  break label424;
                }
                if (k == 0) {}
              }
              else
              {
                localjb1 = localm1.m();
              }
            }
            else {
              localjb2 = localm1.m();
            }
            localm1 = new m(localm1.k(), localm1.l(), localjb1, (jb)localObject2, localm1.o(), localm1.p(), localm1.f());
            localm2 = new m(localm1.k(), localm1.l(), localjb2, localjb3, localm1.o(), localm1.p(), localm1.f());
            localz.a(new b_((h)localObject1, localm1, localm2, null));
            if (!bool)
            {
              if (j == 0) {
                break;
              }
              localm1 = ((h)localObject1).j();
              localObject1 = ((h)localObject1).b();
            }
          } while (k == 0);
          localObject1 = localz.iterator();
          do
          {
            if (!((Iterator)localObject1).hasNext()) {
              break;
            }
            localObject2 = (b_)((Iterator)localObject1).next();
            if (!bool)
            {
              if (((b_)localObject2).b != null) {
                i -= a(((b_)localObject2).a, ((b_)localObject2).b);
              }
              i += a(((b_)localObject2).a, ((b_)localObject2).d);
            }
          } while (k == 0);
        }
      }
    }
    if (!bool) {
      label551:
      i = a(paramh, paramm);
    }
    double d = i * this.f;
    a("crossing cost", d, false);
    return d;
  }
  
  private int a(h paramh, m paramm)
  {
    boolean bool = sb.e;
    int j = sb.d;
    int i = 0;
    z localz1 = paramh.a().b().c();
    if ((bool) || (localz1 != null))
    {
      if (bool) {
        break label232;
      }
      if (!localz1.isEmpty())
      {
        z localz2 = new z();
        HashSet localHashSet = new HashSet();
        y localy = localz1.h();
        label176:
        do
        {
          do
          {
            if (!localy.e()) {
              break;
            }
            m localm = (m)localy.j();
            qc.a_ locala_ = a(paramh, b().d(), localm.k());
            qc.b_ localb_ = localm.a().a(paramm, locala_);
            db localdb = localm.j();
            if (bool) {
              break label232;
            }
            if (j != 0) {
              return i;
            }
            if (localdb != null)
            {
              if (bool) {
                break label176;
              }
              if (!localHashSet.add(localdb)) {}
            }
            else
            {
              i += localb_.a();
            }
            if (!bool)
            {
              if (localb_.d()) {
                localz2.add(localb_.c());
              }
              localy.f();
            }
          } while (j == 0);
        } while (bool);
        if (bool) {
          break label232;
        }
        if (localz2.size() > 0) {
          paramm.x = localz2;
        }
      }
    }
    label232:
    return i;
  }
  
  private qc.a_ a(h paramh, d paramd1, d paramd2)
  {
    boolean bool = sb.e;
    int i = sb.d;
    z localz = paramh.g;
    if (((bool) || (localz != null)) && ((bool) || (!localz.isEmpty())))
    {
      y localy = localz.h();
      do
      {
        if (!localy.e()) {
          break;
        }
        qc.a_ locala_ = (qc.a_)localy.j();
        if (!bool)
        {
          if ((locala_.b() == paramd1) && ((bool) || (locala_.a() == paramd2))) {
            return locala_;
          }
          localy.f();
        }
      } while (i == 0);
    }
    return null;
  }
  
  public void a(h paramh, rb paramrb, byte paramByte)
  {
    boolean bool = sb.e;
    if ((paramByte != 0) && ((bool) || (paramh.b() != null)) && ((bool) || (paramh.j() != null))) {
      paramh.g = paramh.j().x;
    }
  }
  
  private static class b_
  {
    private h a;
    private m b;
    private m d;
    
    private b_(h paramh, m paramm1, m paramm2)
    {
      this.a = paramh;
      this.d = paramm2;
      this.b = paramm1;
    }
    
    b_(h paramh, m paramm1, m paramm2, ec.0 param0)
    {
      this(paramh, paramm1, paramm2);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.a.ec

 * JD-Core Version:    0.7.0.1

 */